<?php
/*
 * This is sugn up page 1.
 */
include '../include/config.php';

$prapid = $_POST['prapid'];
$name = $_POST['name'];
$surname = $_POST['surname'];
$email = $_POST['e_mail'];
$password1 = $_POST['login_password'];
session_start();
$_SESSION['user_name'] = $name;
$_SESSION['sur_name'] = $surname;
$_SESSION['email'] = $email;
$_SESSION['password'] =$password1;


$valid_user = mysql_query("select * from fa_user where user_name = '" . $name . "' ") or die(mysql_error());
if (mysql_num_rows($valid_user) != 0) {
    $err = 'User name taken. Choose another name';
    header('Location:../index?&err=' . $err);
}

if ($prapid == 'yes') {
    $prepaid_code = $_POST['prepaid_code'];
    $_SESSION['prepaid_code']= $_POST['prepaid_code'];
    $p1 = mysql_query("select * from salus_prepaid_codes where prepaid_code='" . $prepaid_code . "' ") or die(mysql_error());
    if (mysql_num_rows($p1) == 0) {
        $err = 'No Code Available';
        header('Location:../index?&err=' . $err);
    } else {
        while ($row = mysql_fetch_array($p1)) {
            $idp = $row[0];
            $comp_id = $row[1];
            $us = $row[3];
        }

        if ($us != '') {
            $err = 'Code is already used.';
            header('Location:../index?&err=' . $err);
        } else {
            
        }
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>SignUP &raquo; SalusBaby</title>
        <link href="../include/css/fal_style.css" rel="stylesheet" type="text/css" />
        <script src="../include/js/jquery.js" type="text/javascript"></script>
        <script src="../include/js/flash.js" type="text/javascript"></script>
        <script src="../include/js/jquery-1.2.6.min.js" type="text/javascript"></script>
    </head>
    <script type="text/javascript">
      
        function apply()
    {
        document.frm.sub.disabled=true;
        if(document.frm.chk.checked==true)
        {
            document.frm.sub.disabled=false;
        }
        if(document.frm.chk.checked==false)
        {
            document.frm.sub.enabled=false;
        }
    }
    function valid()
    {
        var p1 = document.forms['frm']['login_password'].value;
        var p2= document.forms['frm']['c_password'].value;
        if(p1!=p2)
        {
            //document.getElementById('pass_error').visibility = 'visible';
            alert("Enter Same Password \n Password : "+p1+"\n Confirm password : "+p2);
            return false;
        }
       
           
    }
    </script> 



    <body>
        <div id="wrapper">
            <div id="header01"></div>



            <div id="mainContent">             
                <b>Welcome to SalusBaby, <?= $name ?>...!!!</b>
                <div class="content">
                    <div class="float_left">                        
                        <div id="pass_error" style="color: red; visibility: hidden; " >Confirm password error</div>
                        <form id="reg_form" action="p2.php" name="frm" method="post" onsubmit=" return valid();" >
                            <div><input type="text" name="name" id="name" value="<?= $name ?>" placeholder="User name" class="text_field"/></div>
                            <div><input type="text" name="surname" id="surname" value="<?= $surname ?>" placeholder="Surname" class="text_field"/></div>
                            <div><select name="gender" >
                                    <option value="M">Male</option>
                                    <option value="F">Female</option>
                                </select></div>
                            <div><input type="text" name="e_mail" id="e_mail" value="<?= $email ?>" placeholder="email" class="text_field"/></div>
                            <div>
            <!--                    <input type="text" id="password" value="Password" class="text_field"/>-->
                                <input type="hidden" name="login_password" id="s_password" placeholder="password" value="<?= $password1 ?>" class="text_field"/></div>
                            <div><input type="password" name="c_password"  id="c_password" placeholder="Confirm Password" class="text_field"/>
                            </div>
                            <div>                           

                            </div>
                            <div  class="privacy padding_15" style="overflow: scroll;text-align: justify;font-size: 12px;color: #FFFFFF">
                                Within the frameworkof the activitiesofSalusBank &reg;acquiresconfidentialhealth data relatedtoregisteredusers.
                                Therefore, in compliancewith the terms and indicationsofInternational Laws, regulating the treatment of data ofpersons and othersubjects, the company, actingas controller ofsuch information, isobligedto illustrate the conditionsofusageof the data in itspossession.
                                In thisrespectitisspecifiedthat:

                                1. The treatment ofthe data concernedisperformedusingproceduresthatguaranteerespectfor the privacy rightsof the user and consists in collecting, registration, organization, archiving, processing, modification, selection, retrieval, comparison, use, interconnection, grouping, communication, circulation, cancellation and destruction, also via a combinationoftwo or more of the aforementionedprocedures;

                                2. The data treatment itselfissolely in relation to or instrumentalto the activitiesaccordingtotheaims and objectivesof the SalusBank &reg;, more precisely:
                                &bull; tocollect data and information relating to each user essential to constructing an effective emergency programme; thisimplies the necessity, for the system, ofidentifying and recognizing the individualuser;
                                &bull; tocollect data and information in ageneralsense, and also in relation to the inclinations and preferencesof the user;
                                &bull; toissuemessagesofpurelyinformationalcontentabouthealth care and linkedtopics, alsoonbehalfofthirdparties;
                                &bull; toissueinformational material or advertising foractivities in the fieldofHealth Care
                                &bull; to elaboratestatisticalstudies and researchusers and other data, and ifnecessarycommunicatethesetothirdpartiesworkingwithSalusBank &reg;

                                Withreferenceto the abovementionedpurposes, the treatment of personal data willbeperformedmainlyusingautomatic and computerizedmethods, in strictlogicalcorrespondenceto the purposesthemselves and, in anyevent, always in full respectof privacy and security rulesspecifiedbycurrentlaw.

                                The data willbepreserved, for the lengthoftimespecifiedbylaw, at the operationalheadquartersofSalusBank Â®   and on the serversofMediasil Data Center Italy and Switzerlandhandledby the data processing Agency, SB Italia Srl, Via Ripamonti 187, Milano, Italy, and treatedbyemployees and/or professionalsempoweredto do so whowillperform the abovementionedactivities. Forthispurpose, the data maybetransmittedtoexternalbodieswhichperformfunctionsstrictlyconnected and instrumentalto service operations.

                                Conferralofpermissionby the usertotreathis personal datais optional. A refusaltoenter the requested information on the pagededicatedtoregistration, however, renders the service impossible.

                            </div>

                            <div><input type="checkbox" required  id="agree"/>I agree</div>

                            <?php if ($prapid == 'yes') { ?>
                                <input type="hidden" name="prepaid_code" value="<?= $prepaid_code ?>" />
                                <input type="hidden" name="company_id" value="<?= $comp_id ?>" />
                                <input type="hidden" name="idp" value="<?= $idp ?>" />        
                            <?php } ?>
                            <input type="hidden" name="prapid" value="<?= $prapid ?>" />                            
                            <input type="checkbox" name="chk" onClick="apply()" /> I swear all given informations are true.<br/>
<!--                            <div class="float_right"><input type="submit" name="sub" disabled value="" class="btn_join cursor"/></div>-->
                            <input type="submit" name="sub" disabled value="JOIN"  />
                        </form>
                    </div>
                    <div class="clear"></div>
                </div><!--END INCLUDED CONTENT-->
                <div class="clear"></div>                
            </div>
        </div> 
    </body>
</html> 
